# frozen_string_literal: true

require 'bundler/setup'
require 'sinatra/reloader'
Bundler.require :default

Dotenv.load
CABLE_URL = ENV['ANYCABLE'] ? 'ws://localhost:9293/cable' : '/cable'

also_reload '/controllers/*.rb'
also_reload '/models/*.rb'
also_reload '/helpers/*.rb'
also_reload '/config/initializers/*.rb'

set :allow_origin, '*'
set :allow_methods, 'GET,HEAD,POST,OPTIONS,DELETE,PUT'
set :allow_headers, 'content-type,if-modified-since, secure'
set :expose_headers, 'location,link'

Mongoid.load!(File.join(File.dirname(__FILE__), 'config', 'mongoid.yml'))

require_rel %w[libs helpers models controllers]
